package cn.itsource.zcn.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfigurer implements WebMvcConfigurer {

    @Autowired
    private LoginInterceptor loginInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                //拦截地址
                .addPathPatterns("/**")
                //放行地址
                .excludePathPatterns("/user/**") // 前台用户登录，注册
                .excludePathPatterns("/wechat/**") // wx 扫码登录
                .excludePathPatterns("/shop/settlement") // 后台商家注册
                .excludePathPatterns("/code/**")   // 发送短信验证码
                .excludePathPatterns("/emp/login")  // 后台登录
                .excludePathPatterns("/pet/front") //前台商品
                .excludePathPatterns("/pet/detailfront/**") //前台商品详情
                .excludePathPatterns("/payafter/**")  //扫描支付后回调
                .excludePathPatterns("/product/front") //前台服务
                .excludePathPatterns("/product/detailfront/**") //前台服务详情
                .excludePathPatterns("/fastdfs/**");   // 文件上传
    }
}